<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-susdDetail-edit" th:object="${susdDetail}">
            <input id="sudeId" name="sudeId" th:field="*{sudeId}" type="hidden">
            <input id="susdId" name="susdId" th:field="*{susdId}" type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">补助类型：</label>
                <div class="col-sm-8">
					<select id="sudeType" class="form-control m-b" th:with="type=${@dict.getType('pm_susd_type')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  th:field="*{sudeType}"></option>
	                </select>
				</div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">加班类型：</label>
                <div class="col-sm-8">
                    <select id="wowType" class="form-control m-b" th:with="type=${@dict.getType('pm_wow_type')}">
                        <option value="">请选择...</option>
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{wowType}"></option>
	                </select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">补助天数：</label>
                <div class="col-sm-8">
                    <input id="sudeDays" name="sudeDays" th:field="*{sudeDays}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">补助金额：</label>
                <div class="col-sm-8">
                    <input id="sudeAmount" name="sudeAmount" th:field="*{sudeAmount}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">证件号码：</label>
                <div class="col-sm-8">
                    <input id="empId" name="empId" th:field="*{empId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input id="empNm" name="empNm" th:field="*{empNm}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">考勤天数：</label>
                <div class="col-sm-8">
                    <input id="signDays" name="signDays" th:field="*{signDays}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">说明：</label>
                <div class="col-sm-8">
                    <input id="sudeNote" name="sudeNote" th:field="*{sudeNote}" class="form-control" type="text">
                </div>
            </div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/susdDetail"
		$("#form-susdDetail-edit").validate({
			rules:{
				empId:{
					required:true,
				},
				empNm:{
					required:true,
				},
				signDays:{
					required:true,
				}
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            edit();
	        }
	    }
		
		function edit() {
			var sudeId = $("input[name='sudeId']").val();
        	var sudeType = $("#sudeType option:selected").val();
        	var wowType = $("#wowType option:selected").val();
        	var sudeDays = $("input[name='sudeDays']").val();
        	var sudeAmount = $("input[name='sudeAmount']").val();
        	var empId = $("input[name='empId']").val();
        	var empNm = $("input[name='empNm']").val();
        	var signDays = $("input[name='signDays']").val();
        	var sudeNote = $("input[name='sudeNote']").val();
        	var susdId = $("input[name='susdId']").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "pm/susdDetail/edit",
        		data : {
        			"sudeId": sudeId,
        			"sudeType": sudeType,
        			"wowType": wowType,
        			"sudeDays": sudeDays,
        			"sudeAmount": sudeAmount,
        			"empId": empId,
        			"empNm": empNm,
        			"signDays": signDays,
        			"sudeNote": sudeNote,
        			"susdId": susdId
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
